// 时间格式化
export const formatter = (time: string) => {
    const date = new Date(time);
    const formattedDate = date.toLocaleDateString() + ' ' + date.toLocaleTimeString()
    return formattedDate;
}
// 物品价值
export const goodsWorth = (worth: number) => {
    switch (true) {
        case worth >= 0 && worth <= 1000:
            return 'bg-blue-400'
        case worth > 1000 && worth <= 5000:
            return 'bg-orange-400'
        case worth > 5000 && worth <= 10000:
            return 'bg-red-400'
    }
}
// 物品分类
export const groupByType = (arr: any[]) => {
    return arr.reduce((acc, item) => {
        const key = item.type;
        if (!acc[key]) {
            acc[key] = [];
        }
        acc[key].push(item);
        return acc;
    }, {});
};